import 'package:flutter/material.dart';
import 'package:ost_flutter_module/common/adapt.dart';
import 'package:ost_flutter_module/common/color.dart';
import 'package:ost_flutter_module/widget/custom_widget/text_button.dart';

class GBottomButton extends StatelessWidget {
  final List<Widget> children;
  final String title;
  final VoidCallback onPressed;
  const GBottomButton({
    Key key,
    this.onPressed,
    this.children,
    this.title,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    children.add(_bottomButton());
    return Stack(children: children);
  }

  Widget _bottomButton() => Positioned(
        left: 0,
        right: 0,
        bottom: 30,
        child: Center(
          child: Container(
            width: Adapt.px(180),
            height: Adapt.px(36),
            child: GTextButton(
              title: title ?? '保存',
              normalForgroundColor: color42270C,
              normalBackgroundColor: colorFACD33,
              radius: 18,
              onPressed: () {
                onPressed();
              },
            ),
          ),
        ),
      );
}
